<? startScript('jquery, jquery.tools'); ?><script type="text/javascript">jQuery(function($) { 

	$("ul.jt-tabs").tabs("div.jt-panes > div"); 
	
	var kind = {1:"image", 2:"video"};
	
	$('select[name="kind"]').change(function(){
		var a = $(this).find("option:selected").val();
		if (a = kind[a]) {
			$(".kind").hide();
			$("#" + a).show();
		}
	}).change();
	
});</script><? endScript(); ?>

<form action="" method="post" enctype="multipart/form-data">


<div>
	<fieldset>
		<legend> = </legend>
		
		<p><label>Название слайда<br />
			<input type="text" class="xwide" name="title" value="<?=hdat('object', 'title')?>" /></label>
		</label></p>

		<p><label>Тип слайда<br />
			<select name="kind">
				<option value="1" <?=(dat('object', 'kind') == 1) ? 'selected' : ''?>>Картинка</option>
				<option value="2" <?=(dat('object', 'kind') == 2) ? 'selected' : ''?>>Видео</option>
			</select>
		</label></p>

		<div id="image" class="kind"><label>Картинка (размер: <?=talkImageSize($s['sw'], $s['sh'])?>)<br />
			<input type="file" name="image" class="wide" /></label>
			<? if ($im = dat('object','image')) { ?>
				<div class="spaced"><img src="<?=$im['fn']?>" /></div>
			<? } ?>
		</div>
		
		<p id="video" class="kind"><label>URL видео на youtube.com<br />
			<input type="text" class="xwide" name="video" value="<?=hdat('object', 'video')?>" /></label>
		</label></p>

	</fieldset>
</div>


<? if (sizeof($DIAGS)) { ?>
	<div class="diags"><p><?=implode("</p><p>", $DIAGS)?></p></div>
<? } ?>


<ul class="jt-tabs"><?

	foreach($DATA['langs'] as $lang) {
		?><li><a href="#<?=$lang['text']?>"><?=$lang['assoc']?></a></li><? 
	} 
	
?></ul>

<div class="jt-panes">

	<? $t = true; 
		foreach($DATA['langs'] as $lang) { $l = $lang['text'];

		?><div class="jt-pane" style="<?=$t ? "display:block" : ""?>">

			<p><label>Текст слайда<br />
				<textarea class="xwide" name="text[<?=$l?>]"><?=dat('object', 'data', $l, 'text')?></textarea></label>
			</p>

		</div><? 
	
	$t = false; } ?>

</div>

<p><input type="submit" name="editor_save" value="Save" />
	<? if (!($DATA['object']['attr'] & AA_VISIBLE)) { ?><input type="submit" name="editor_save_enable" value="Save and Enable" /><? } ?>
	<a href="<?=_transformURL($CURRENT->url, array('remove_param' => 'slide'))?>" title="Return to the list">Cancel</a>
</p>

</form>
